#include	"interrupt.h"
#include	"can.h"


u16	F_Time_1ms    = 0;
u16	F_Time_10ms   = 0;
u16	F_Time_33ms   = 0;
u16	F_Time_100ms  = 0;
u16	F_Time_500ms  = 0;
u16	F_Time_1000ms = 0;

u16	T_10MS_Cnt   = 10;
u16	T_33MS_Cnt   = 33;
u16	T_100MS_Cnt  = 10;
u16	T_500MS_Cnt  = 50;
u16	T_1000MS_Cnt = 100;

//************************************************************************************
//	Interrupt routine Multi
//************************************************************************************

void ISR_TM2(void)
{
	F_Time_1ms = 1;							//1ms flag
	
	T_33MS_Cnt--;
	if(T_33MS_Cnt == 0)
	{
		T_33MS_Cnt = 33;
		F_Time_33ms = 1;				 //33ms flag
	}
	T_10MS_Cnt--;
	if(T_10MS_Cnt == 0)
	{
		T_10MS_Cnt = 10;
		F_Time_10ms = 1;					//10ms flag
		T_100MS_Cnt--;
		if(T_100MS_Cnt == 0) 			//100ms
		{
			T_100MS_Cnt = 10;
			F_Time_100ms = 1;
		}
		T_500MS_Cnt--;
		if(T_500MS_Cnt == 0)
		{
			T_500MS_Cnt = 50;
			F_Time_500ms = 1;				//500ms flag
		}
		T_1000MS_Cnt--;
		if(T_1000MS_Cnt == 0)
		{
			T_1000MS_Cnt = 100;
			F_Time_1000ms = 1;		 //1s flag
			
			if(CAN1_AircdRxResetTime1)
				CAN1_AircdRxResetTime1--;
			if(CAN2_AircdRxResetTime1)
				CAN2_AircdRxResetTime1--;
		}
	}
}


